package zhuyun.code


class Main {
    companion object {
        @JvmStatic
        fun main(args:Array<String>){
            val word:String? = readLine()
            if(detectCapitalUse(word!!)){
                println("大写用法正确!")
            }
        }
        private fun detectCapitalUse(word: String): Boolean {
            val firstCharIsUpper = word.let {it[0] == it[0].toUpperCase()}
            if(word.length == 1){
                return true
            }
            val secondCharIsUpper = word.let {it[1] == it[1].toUpperCase()}
            if(firstCharIsUpper&&secondCharIsUpper){
                return word.let { it.toUpperCase() == it }
            } else {
                if(firstCharIsUpper&&!secondCharIsUpper){
                    return word.let { it.substring(1).toLowerCase()==it.substring(1) }
                }
                else{
                    if(!firstCharIsUpper&&!secondCharIsUpper){
                        return word.let { it.toLowerCase() == it }
                    } else {
                        return false
                    }
                }
            }

        }
    }


}